﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace PlugNT.Cms.ActionLabel
{
    public class FriendLink
    {
        /// <summary>
        /// 文章调用类(图片)
        /// </summary>
        /// <param name="topCount"></param>
        /// <param name="clsno"></param>
        /// <param name="type"></param>
        /// <param name="sort"></param>
        /// <param name="postfix"></param>
        /// <param name="isexact"></param>
        /// <returns></returns>
        public static string ViewImageList(int topCount, string clsno, int type)
        {
            BLL.FriendLink bll = new BLL.FriendLink();
            StringBuilder strTxt = new StringBuilder();
            int ou = 0;
            DataTable dt = bll.GetList(topCount, 0, clsno, type);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt.Rows[i];
                    strTxt.Append("<div class=\"link\">");
                    strTxt.Append("<a href=\"http://" + dr["targeturl"].ToString() + "\" target=blank>");
                    strTxt.Append("<img src=\"" + dr["image"].ToString() + "\" alt=\"" + dr["text"].ToString() + "\" />");
                    strTxt.Append("</a>");
                    strTxt.Append("</div>");
                }
            }
            else
            {
                strTxt.Append("暂无数据显示...");
            }
            return strTxt.ToString();
        }
    }
}
